import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by Administrator on 2016/3/8.
  */
object TestSpark {

  val conf = new SparkConf() //
    .setAppName("TestSpark") //
    .setMaster("local")

  val sc = new SparkContext(conf)

  def testSpark() = {
    val file = sc.textFile("file:///D:/SogouQ.reduced")
    println(file.count())
  }

  def main(args: Array[String]): Unit = {
    testReadFromHDFS()
    sc.stop()
  }

  def testReadFromHDFS() = {
    val file = sc.textFile("hdfs://172.17.0.7:9000/user/root/input/file1.txt")
    file.collect().foreach(println)
  }

}